import HttpService from '../../app/services/httpService.js';

class ChipService extends HttpService {
    constructor($http, $q){
        super($http, $q)

        this.URL = this.baseUrl();

        this.OBJ = {
        	ChipCreateUrl: this.URL + '/chip/create?race_id=',
            ChipDetailUrl: this.URL + '/chip/detail?id=',
            ChipUpdateUrl: this.URL + '/chip/update?id=',
            ChipDelUrl: this.URL + '/chip/del?race_id=',
            ChipClearUrl: this.URL + '/chip/clear?race_id=',
            ChipImportUrl: this.URL + '/chip/import?race_id=',
        }

    }

    /* 创建芯片 */
    postChipCreate(params, headers, search) {
        return this.postRequest(this.OBJ.ChipCreateUrl, params, headers, search);
    }

    /* 获取芯片详情 */
    getChipDetail(headers, search) {
        return this.getRequest(this.OBJ.ChipDetailUrl, headers, search);
    }

    /* 更新芯片详情 */
    postChipUpdate(params, headers, search) {
        return this.postRequest(this.OBJ.ChipUpdateUrl, params, headers, search);
    }

    /* 删除芯片 */
    postChipDel(params, headers, search) {
        return this.postRequest(this.OBJ.ChipDelUrl, params, headers, search);
    }

    /* 清空芯片 */
    postChipClear(params, headers, search) {
        return this.postRequest(this.OBJ.ChipClearUrl, params, headers, search);
    }

    /* 导入芯片信息 */
    postChipImport(params, headers, search) {
        return this.postMultipart(this.OBJ.ChipImportUrl, params, headers, search);
    } 

}

export default ChipService;